import { OnStartQueueConfig } from '../types/index';
import { getTaskInstance } from 'src/config';
import { queueManager } from '../manager/index';

export default function OnStart(config: OnStartQueueConfig) {
  return (target, key, descriptor) => {
    config['type'] = 'OnStart'
    config['target'] = getTaskInstance(target.constructor)
    config['method'] = key
    queueManager.addOnStartConfig(config)
    return descriptor
  }
}